<%-- 
    Document   : View Class Works
    Created on : Nov 10, 2013, 10:46:15 PM
    Author     : reynier
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="../../assets/ico/favicon.png">

        <title>GRS View Class Works</title>

        <!-- Bootstrap core CSS -->
        <link href="../libs/bootstrap/css/bootstrap.css" rel="stylesheet">
        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="../../assets/js/html5shiv.js"></script>
          <script src="../../assets/js/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <header>
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header"><p class="navbar-text navbar-left">Grade Report System</p></div>
                <form class="navbar-form navbar-right" method="post" action="../login" >
                    <div class="form-group">Signed in as ${sessionScope.UserName}</div>
                    <button id="logout" name="logout" type="submit" class="btn btn-link">(Log out)</button>
                </form>
            </nav>    
        </header>
        <div class="container">
            <div id="successMessageContainer" class="alert alert-success" style="display: none;">
                <a class="close" data-dismiss="alert" href="#">×</a><span id="successMessage">${messages.success}</span>
            </div>
            <div id="errorMessageContainer" class="alert alert-danger" style="display: none;">
                <a class="close" data-dismiss="alert" href="#">×</a><span id="errorMessage">${messages.error}</span>
            </div>
            <form class="" method="post" action="viewClassWorks" >
                <p class="navbar-text navbar-right">
                    <button type="submit" name="backToCourses" id="backToCourses" class="btn btn-default btn-lg">
                        <span class="glyphicon glyphicon-circle-arrow-left"></span> Back to courses
                    </button>
                </p>
                <h2>Class Works</h2>
                <p class="lead">Add or edit class works for this course.</p>
            </form>
            <div class="list-group">
                <h4 class="list-group-item-heading">(${section.getSectionName()}) <span class="text-info"> ${section.getCourse().getCourseCode()} - ${section.getCourse().getCourseName()}</span></h4>
                <p class="list-group-item-text">${section.getProfessor().getFirstName()} ${section.getProfessor().getLastName()}</p>
            </div>

            <form class="" method="post" action="viewClassWorks" >
                <div class="list-group">
                    <input type="hidden" name="sectionId" id="sectionId" value="${section.getSectionID()}">
                    <input type="hidden" name="classWorkId" id="classWorkId" class="classWorkId">
                    <button type="submit" class="btn btn-primary" name="addClassWork" id="addClassWork"><span class="glyphicon glyphicon-plus"></span> Add</button>
                    <button type="submit" class="hidden" name="submitDeleteClassWork" id="submitDeleteClassWork"></button>
                    <button type="submit" class="hidden" name="enterGrades" id="enterGrades"></button>
                </div>
            </form>

            <form method="get" action="enterClassWorkGrades" id="frmGradeClassWork">
                <input type="hidden" name="sectionId" id="sectionId" value="${section.getSectionID()}">  
                <input type="hidden" name="classWorkId" id="classWorkId" class="classWorkId">
                <input type="hidden" name="classWorkId" id="classWorkId">
                <button type="submit" class="hidden" name="submitGradeClassWork" id="submitGradeClassWork"></button>            
            </form>


            <div class="row">
                <div class="span5">
                    <table class="table table-striped table-condensed">
                        <thead>
                            <tr>
                                <th>Name</div>
                                <th>Assigned Date</div>
                                <th>Due Date</th>
                                <th>Max Points</th>
                                <th>Weight</th>
                                <th class="col-xs-2"></th>
                            </tr>
                        </thead>   
                        <tbody>
                            <c:forEach items="${classWorks}" var="classWork">
                                <tr>
                                    <td>${classWork.getName()}</td>
                                    <td>${classWork.getAssignedDate()}</td>
                                    <td>${classWork.getDueDate()}</td>
                                    <td>${classWork.getMaxPoints()}</td>
                                    <td>${classWork.getWeight()}%</td>
                                    <td>
                                        <button type="submit" class="btn btn-primary" name="gradeClassWork" id="gradeClassWork" title="Grade this class work"><span class="glyphicon glyphicon-pencil"></span></button>
                                        <button type="submit" class="btn" name="editClassWork" id="editClassWork" title="Edit this class work">
                                            <span class="glyphicon glyphicon-edit"></span>
                                        </button>
                                        <button type="submit" class="btn" name="deleteClassWork" id="deleteClassWork" title="Delete this class work"><span class="glyphicon glyphicon-trash"></span></button>
                                        <input type="hidden" id="edit_classWorkId" name="edit_classWorkId" value="${classWork.getClassWorkId()}" >



                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div> <!-- /container -->


        <!-- Bootstrap core JavaScript
        ================================================== -->
        <script src="../libs/jquery/jquery-2.0.3.min.js"></script>
        <script src="../libs/bootstrap/js/bootstrap.min.js"></script>
        <script src="../scripts/viewClassWorks.js"></script>
        <!-- Placed at the end of the document so the pages load faster -->
    </body>
</html>

